// ++++++++++++++++++++++++++++++++++++++++
// 《零基础Go语言算法实战》源码
// ++++++++++++++++++++++++++++++++++++++++
// Author:廖显东（ShirDon）
// Blog:https://www.shirdon.com/
// Gitee:https://gitee.com/shirdonl/goAlgorithms.git
// Buy link :https://item.jd.com/14101229.html
// ++++++++++++++++++++++++++++++++++++++++

package main

import "fmt"

type HashSet struct {
	h []bool
}

func Constructor() HashSet {
	return HashSet{make([]bool, 1000001)}
}

func (hs *HashSet) Add(key int) {
	hs.h[key] = true
}

func (hs *HashSet) Remove(key int) {
	hs.h[key] = false
}

func (hs *HashSet) Contains(key int) bool {
	return hs.h[key]
}

func main() {
	obj := Constructor()
	obj.Add(6)
	obj.Remove(8)
	res := obj.Contains(6)
	fmt.Println(res)
}

//$ go run interview3-10.go
//true
